package com.itheima.book.manager.entry;

import com.itheima.book.manager.controller.BaseBookController;
import com.itheima.book.manager.controller.BookController;
import com.itheima.book.manager.controller.BookController2;

import java.util.Random;

public class BookManagerEntry {
    public static void main(String[] args) {
        //main方法加了static修饰，在静态环境中只能访问静态方法
        //因此，getBaseBookController()要加static修饰
        BaseBookController baseBookController = getBaseBookController();
        baseBookController.start();
    }

    public static BaseBookController getBaseBookController(){
        Random random = new Random();
        int i = random.nextInt(2);
        switch (i){
            case 0:
                return new BookController();
            case 1:
                return new BookController2();
        }
        //为了方法不报错
        return null;
    }
}
